package com.zhangxu.microservice.system.web.config.security;

import org.springframework.context.annotation.Bean;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;

/**
 * 密码编码器配置
 * 用于密码的加密和验证
 */
@Component
public class PasswordEncoderConfig {

    /**
     * 配置BCrypt密码编码器
     * 强度为4，适合大多数场景的安全性和性能平衡
     */
    @Bean
    public PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder(4);
    }

}